<template>
	<!-- 'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
		'uni-calendar-item--checked':(calendar.fullDate === weeks.fullDate && !weeks.isDay) , -->
	<view class="uni-calendar-item__weeks-box" :class="{
		'uni-calendar-item--disable':weeks.disable,
		
		'uni-calendar-item--before-checked':weeks.beforeMultiple,
		'uni-calendar-item--multiple': weeks.multiple,
		'uni-calendar-item--after-checked':weeks.afterMultiple,
		}" @click="choiceDate(weeks)">
		<view class="uni-calendar-item__weeks-box-item">
			<!-- <text v-if="selected&&weeks.extraInfo&&weeks.extraInfo.data" class="uni-calendar-item__weeks-box-msg">{{weeks.extraInfo.data.custom}}</text> -->
			<view v-if="selected && weeks.extraInfo" class="uni-calendar-item__weeks-box-circles"> <!-- &&weeks.extraInfo.data -->
				<!-- <view v-if="weeks.extraInfo.examCount<=0" class="circle yellow" v-for="(item, index) in weeks.extraInfo.classScheduleCount" :key="index"></view>
				<view v-if="weeks.extraInfo.examCount<=0" class="circle purple" v-for="(item, index) in weeks.extraInfo.homeworkCount" :key="index"></view>
				<view v-if="weeks.extraInfo.examCount<=0 && weeks.extraInfo.autoTestCount > 0" class="circle skyblue"></view>
				<text v-if="weeks.extraInfo.examCount>0" class="uni-calendar-item__weeks-box-msg">正考</text> -->
				<view v-if="weeks.extraInfo.examCount<=0 && weeks.extraInfo.classScheduleCount" class="circle yellow"></view>
				<view v-if="weeks.extraInfo.examCount<=0 && weeks.extraInfo.homeworkCount" class="circle purple"></view>
				<view v-if="weeks.extraInfo.examCount<=0 && weeks.extraInfo.autoTestCount > 0" class="circle skyblue"></view>
				<text v-if="weeks.extraInfo.examCount>0" class="uni-calendar-item__weeks-box-msg">正考</text>
				
				
			</view>
			<text v-if="!(!lunar&&!weeks.extraInfo && weeks.isDay)" class="uni-calendar-item__weeks-box-text" :class="{
				'uni-calendar-item--isDay-text': weeks.isDay,
				'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
				'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
				'uni-calendar-item--before-checked':weeks.beforeMultiple,
				'uni-calendar-item--multiple': weeks.multiple,
				'uni-calendar-item--after-checked':weeks.afterMultiple,
				'uni-calendar-item--disable':weeks.disable,
				}">{{weeks.isDay? todayText :weeks.date}}</text>
			<text v-if="!lunar&&!weeks.extraInfo && weeks.isDay" class="uni-calendar-item__weeks-lunar-text" :class="{
				'uni-calendar-item--isDay-text':weeks.isDay,
				'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
				'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
				'uni-calendar-item--before-checked':weeks.beforeMultiple,
				'uni-calendar-item--multiple': weeks.multiple,
				'uni-calendar-item--after-checked':weeks.afterMultiple,
				}">{{todayText}}</text>
			<text v-if="lunar&&!weeks.extraInfo" class="uni-calendar-item__weeks-lunar-text" :class="{
				'uni-calendar-item--isDay-text':weeks.isDay,
				'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
				'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
				'uni-calendar-item--before-checked':weeks.beforeMultiple,
				'uni-calendar-item--multiple': weeks.multiple,
				'uni-calendar-item--after-checked':weeks.afterMultiple,
				'uni-calendar-item--disable':weeks.disable,
				}">{{weeks.isDay?todayText: (weeks.lunar.IDayCn === '初一'?weeks.lunar.IMonthCn:weeks.lunar.IDayCn)}}</text>
			<!-- <text v-if="weeks.extraInfo&&weeks.extraInfo.info" class="uni-calendar-item__weeks-lunar-text" :class="{
				'uni-calendar-item--extra':weeks.extraInfo.info,
				'uni-calendar-item--isDay-text':weeks.isDay,
				'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
				'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
				'uni-calendar-item--before-checked':weeks.beforeMultiple,
				'uni-calendar-item--multiple': weeks.multiple,
				'uni-calendar-item--after-checked':weeks.afterMultiple,
				'uni-calendar-item--disable':weeks.disable,
				}">{{weeks.extraInfo.info}}</text> -->
		</view>
	</view>
</template>

<script>
	import {
	initVueI18n
	} from '@dcloudio/uni-i18n'
	import messages from './i18n/index.js'
	const {	t	} = initVueI18n(messages)
	export default {
		emits:['change'],
		props: {
			weeks: {
				type: Object,
				default () {
					return {}
				}
			},
			calendar: {
				type: Object,
				default: () => {
					return {}
				}
			},
			selected: {
				type: Array,
				default: () => {
					return []
				}
			},
			lunar: {
				type: Boolean,
				default: false
			}
		},
		computed: {
			todayText() {
				return t("uni-calender.today")
			},
		},
		methods: {
			choiceDate(weeks) {
				this.$emit('change', weeks)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.uni-calendar-item__weeks-box {
			flex: 1;
			/* #ifndef APP-NVUE */
			display: flex;
			/* #endif */
			flex-direction: column;
			justify-content: center;
			align-items: center;
		}
	
		.uni-calendar-item__weeks-box-text {
			font-size: $uni-font-size-base;
			color: $uni-text-color;
		}
	
		.uni-calendar-item__weeks-lunar-text {
			font-size: $uni-font-size-sm;
			color: $uni-text-color;
		}
	
		.uni-calendar-item__weeks-box-item {
			position: relative;
			/* #ifndef APP-NVUE */
			display: flex;
			/* #endif */
			flex-direction: column;
			justify-content: center;
			align-items: center;
			width: 100rpx;
			height: 100rpx;
		}
	
		.uni-calendar-item__weeks-box-circle {
			position: absolute;
			top: 5px;
			right: 5px;
			width: 8px;
			height: 8px;
			border-radius: 8px;
			background-color: $uni-color-error;
	
		}
		
		.uni-calendar-item__weeks-box-msg {
			// position: absolute;
			// top: 5px;
			// right: 5px;
			// width: 8px;
			// height: 8px;
			color: #00C780;
			font-size: 20rpx;
		}
		
		.uni-calendar-item__weeks-box-circles {
			font-size: 12rpx;
			position: absolute;
			bottom: -2px;
			//left: calc(50% - 15px);
			width: 100%;
			height: 14px;
			display: flex;
			justify-content: center;
			flex-wrap: wrap;
			align-items: center;
			overflow: hidden;
			z-index: 2;
			.circle {
				width: 4px;
				height: 4px;
				border-radius: 2px;
				background-color: red;
				margin: 1px 1px;
			}
			.green {
				background-color: #00C780;
			}
			.yellow {
				background-color: #FFA700;
			}
			.purple {
				background-color: #8A8DFF;
			}
			.skyblue{
				background-color: #8ADDFF ;
			}
		}
	
		.uni-calendar-item--disable {
			background-color: rgba(249, 249, 249, $uni-opacity-disabled);
			color: #999999;
		}
	
		.uni-calendar-item--isDay-text {
			// color: $uni-color-primary;
			color: #00BB82;
			border: 1px solid #00BB82;
			height: 48rpx;
			line-height: 48rpx;
			width: 48rpx;
			border-radius: 50%;
			text-align: center;
		}
	
		.uni-calendar-item--isDay {
			// background-color: $uni-color-primary;
			opacity: 0.8;
			color: #ffffff;
			background-color: #00BB82;
			height: 48rpx;
			line-height: 48rpx;
			width: 48rpx;
			border-radius: 50%;
			text-align: center;
		}
	
		.uni-calendar-item--extra {
			color: $uni-color-error;
			opacity: 0.8;
		}
	
		.uni-calendar-item--checked {
			// background-color: $uni-color-primary;
			color: #fff;
			opacity: 0.8;
			background-color: #00BB82;
			height: 50rpx;
			line-height: 50rpx;
			width: 50rpx;
			border-radius: 50%;
			text-align: center;
		}
		
		.uni-calendar-item--selected {
			// background-color: $uni-color-primary;
			color: #fff;
			opacity: 0.8;
			background-color: #00BB82;
			height: 50rpx;
			line-height: 50rpx;
			width: 50rpx;
			border-radius: 50%;
			text-align: center;
		}
	
		.uni-calendar-item--multiple {
			background-color: $uni-color-primary;
			color: #fff;
			opacity: 0.8;
		}
		.uni-calendar-item--before-checked {
			background-color: #ff5a5f;
			color: #fff;
		}
		.uni-calendar-item--after-checked {
			background-color: #ff5a5f;
			color: #fff;
		}
		.my-calendar-auto {
			position: relative;
		}
		.diandian {
			position: absolute;
			left: 26rpx;
			bottom: -20rpx;
			width: 8rpx;
			height: 8rpx;
			background: #CCCCCC;
			border-radius: 50%;
		}
	</style>
